package redis

import (
	"github.com/go-redis/redis"
	_ "github.com/go-redis/redis"
	"time"
)

/*
 基于go-redis
 github地址:https://github.com/go-redis/redis
 设置小时demo
*/
func SetHour() (result *redis.StatusCmd) {
	client := GetClient()
	// 注意time.Hour 要乘以一个具体的数值
	set := client.Set("hour", "3个小时", time.Hour*3)
	return set
}

/*
 基于go-redis
 github地址:https://github.com/go-redis/redis
 设置分钟demo
*/
func SetMini(key string, value string, i int64) (result *redis.StatusCmd) {
	client := GetClient()
	// 注意time.Minute 要乘以一个具体的数值
	set := client.Set(key, value, time.Duration(i) * time.Minute)
	return set
}

/*
 基于go-redis
 github地址:https://github.com/go-redis/redis
 get的demo
*/
func Get(key string) string {
	c := GetClient()
	get := c.Get(key)
	result, _ := get.Result()
	return result
}
